<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

class ProductFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        $item = [
            ['name' => $this->faker->sentence(), 'url' => $this->faker->imageUrl()],
            ['name' => $this->faker->sentence(), 'url' => $this->faker->imageUrl()],
        ];

        return [
            'serial_no' => $this->faker->unique()->numerify('SN##########'),
            'title' => $this->faker->sentence(3),
            'image' => $this->faker->imageUrl(),
            'images' => implode(',', [$this->faker->imageUrl(), $this->faker->imageUrl()]),
            'price' => $this->faker->randomFloat(2, 100, 500),
            'unit' => $this->faker->randomElement(['kg', 'g', 'l', 'pcs']),
            'stock' => $this->faker->numberBetween(200, 300),
            'content' => $this->faker->text(500),
            'items' => json_encode($item),
        ];
    }
}
